#include<iostream>
using namespace std;
int n;
double hh;
char op[2];
int main()
{
	cin>>n;
	while(n--)
	{
		cin>>op>>hh;
		if(*op=='M')
		hh=hh/1.09;
		else
		hh=hh*1.09;
		printf("%.2f",hh);
	}
	return 0;
}
